console.log('-----------------------------------------------------');
// function * func1(){};
// const func1 = function *(){};
// const obj = {
//     * func(){

//     }
// }
// class generator1 {
//     * func(){

//     }
// }
// class generator2 {
//     static * func(){

//     }
// }
console.log('------------------------------------------------------');
function * Generator(){};
const generator = Generator();
console.log(generator);//Object [Generator] {}
console.log(generator.next);//[Function: next]
console.log(generator.next());//{ value: undefined, done: true }

function * generatorFunc(){
    console.log('---generatorFunc--');
    return 'bar';
}
const func = generatorFunc();
console.log(func);//Object [Generator] {}
console.log(func.next);//[Function: next]
console.log(func.next());//{ value: 'bar', done: true }
console.log(func.next());
// Object [Generator] {}
// [Function: next]
// ---generatorFunc--
// { value: 'bar', done: true }
// { value: undefined, done: true }
console.log('--------------------------------------------------');
function * generatorFunc2(){
    console.log('====generatorFunc2===');
    return 'generatorFunc2';
}
console.log(generatorFunc2);//[GeneratorFunction: generatorFunc2]
console.log(generatorFunc2()[Symbol.iterator]);//[Function: [Symbol.iterator]]
console.log(generatorFunc2()[Symbol.iterator]());//Object [Generator] {}
console.log(generatorFunc2());//Object [Generator] {}

const  generatorfunc2 = generatorFunc2();
console.log(generatorfunc2 === generatorfunc2[Symbol.iterator]());//true



